function test(code) {
//	alert("aaaaaaaaaaa");
    cancelBubble();
	plugin.call(code);
}

function cancelBubble(e) {
    var evt = e ? e : window.event;
    if(evt.stopPropagation) { //W3C
        evt.stopPropagation();
    } else { //IE
        evt.cancelBubble = true;
    }
}


function CalledByJavaCodeWithPara(id,arg){
     document.getElementById(id).innerHTML = arg;
}

function scrollTop(id){
    var input = document.getElementById(id); // 根据ID取得元素对象
    var sizeObj = input.getBoundingClientRect(); // 取得元素距离窗口的绝对位置
    var inputOffsetTop = sizeObj.top +0;// bodyOffset.top; // 距顶部
//     $("body").animate({
//         scrollTop: inputOffsetTop //让body的scrollTop等于pos的top，就实现了滚动
//     });

     var hTop = input.offsetTop;
     document.documentElement.scrollTop  = hTop;
    return inputOffsetTop;
}
//function scrollTops(id){
//    var input = document.getElementById(id); // 根据ID取得元素对象
//    var sizeObj = input.getBoundingClientRect(); // 取得元素距离窗口的绝对位置
//    var inputOffsetTop = sizeObj.top +0;// bodyOffset.top; // 距顶部
////     $("body").animate({
////         scrollTop: inputOffsetTop //让body的scrollTop等于pos的top，就实现了滚动
////     });
//
//     var hTop = input.offsetTop;
//     document.documentElement.scrollTop  = hTop;
//    return inputOffsetTop;
//}

//滚动到相应DIV
function scrollAnswer2(answerid,height) {
     var _top = 0;
     var input = document.getElementById(answerid); // 根据ID取得元素对象
     var scroll_offset = $(input).offset(); //得到box这个div层的offset，包含两个值，top和left
     var ImgVal = 0;
     if ($("img").length > 0) {
         var ImgFirstVal = $("img:first-child").offset().top;
         var ImgLastVal = $("img:last-child").offset().top;
         var ImgLastImgVal = $("img:last-child").css("height");
         var ImgVal = parseFloat(ImgLastVal) - parseFloat(ImgFirstVal) + parseFloat(ImgLastImgVal);
     }

//    document.documentElement.scrollTop  = 100000;
    var windowHeight=height/2;
    var scrollHeight=scroll_offset.top + ImgVal;
    if (scrollHeight > windowHeight) {
        scrollHeight = scrollHeight - windowHeight;
    }else{
        scrollHeight=0;
   }
     $("body").animate({
                 scrollTop: scrollHeight//让body的scrollTop等于pos的top，就实现了滚动
             });
//    window.scrollTo(0,scroll_offset.top + ImgVal);
}

//滚动到相应DIV
function scrollToPoint(answerid) {
    var _top = 0;
    var input = document.getElementById(id); // 根据ID取得元素对象
    var scroll_offset = $(input).offset(); //得到box这个div层的offset，包含两个值，top和left
    var ImgVal = 0;
    if ($("img").length > 0) {
        var ImgFirstVal = $("img:first-child").offset().top;
        var ImgLastVal = $("img:last-child").offset().top;
        var ImgLastImgVal = $("img:last-child").css("height");
        var ImgVal = parseFloat(ImgLastVal) - parseFloat(ImgFirstVal) + parseFloat(ImgLastImgVal);
    }
    $("body,html").animate({
             scrollTop: scroll_offset.top + ImgVal //让body的scrollTop等于pos的top，就实现了滚动
         });
    return scroll_offset.top + ImgVal;
}

function topHeight(id){
     var _top = 0;
     var input = document.getElementById(id); // 根据ID取得元素对象
     var scroll_offset = $(input).offset(); //得到box这个div层的offset，包含两个值，top和left
     var ImgVal = 0;
     if ($("img").length > 0) {
         var ImgFirstVal = $("img:first-child").offset().top;
         var ImgLastVal = $("img:last-child").offset().top;
         var ImgLastImgVal = $("img:last-child").css("height");
         var ImgVal = parseFloat(ImgLastVal) - parseFloat(ImgFirstVal) + parseFloat(ImgLastImgVal);
     }
     return scroll_offset.top + ImgVal;
}

function topHeight1(ID) {
     var JQStr = "#" + ID;
     var ReVal = $(JQStr).css("height");
     ReVal = parseFloat(ReVal);
     return ReVal;
}

////滚动到相应DIV
//function getQuesBodyHeight(answerid) {
//    var ansDom = $(".answertext[answer-id='" + answerid + "']");
////    $(ansDom).addClass("select-answer");
//    var scroll_offset = $(ansDom).offset(); //得到box这个div层的offset，包含两个值，top和left
//
//    $("body,html").animate({
//        scrollTop: scroll_offset.top //让body的scrollTop等于pos的top，就实现了滚动
//    });
//}

function slideTo (targetPageY) {
     var timer = setInterval(function () {
        var currentY = document.documentElement.scrollTop || document.body.scrollTop;//当前及滑动中任意时刻位置
        var distance = targetPageY > currentY ? targetPageY - currentY : currentY - targetPageY;//剩余距离
        var speed = Math.ceil(distance/10);//每时刻速度
        if (currentY == targetPageY) {
            clearInterval(timer);
        }else{
            window.scrollTo(0,targetPageY > currentY ? currentY + speed : currentY - speed);
        }
     },10);
}

function setBackGroundColor(id,bgColor,radius){
    document.getElementById(id).style.backgroundColor = bgColor;
    document.getElementById(id).style.borderRadius = radius;
}

function CalledByJavaCodeWithPara(id,arg){
     document.getElementById(id).innerHTML = arg;
}

function setFillEmptyStyle(id,bgColor,radius,arg){
    document.getElementById(id).style.backgroundColor = bgColor;
//    document.getElementById(id).style.borderRadius = radius;
    document.getElementById(id).innerHTML = arg;


}

function hideBackElement(){
    var allElements =document.getElementsByClassName("icon-b00401 hydrated");
    for (var i=0; i< allElements.length; i++ ){
        allElements[i].style.display = 'none';
    }
}


//function setFillEmptyStyle(id,bgColor,radius,txtColor,txt){
//    document.getElementById(id).style.backgroundColor = bgColor;
//    document.getElementById(id).style.borderRadius = radius;
//    document.getElementById(id).style.color= txtColor;
//    document.getElementById(id).v
//}





